package com.spi.soconversion.orders.conversion;

public enum RestockingFeeCategory {
	
	C501("501","58213000, UPHOLSTERED FURNITURE, Furniture Restocking Fee, Y"),
	C502("502","58213000, LEATHER UPHOLSTERY, Furniture Restocking Fee, Y"),
	C504("504","58213000, GLUCKSTEIN LIVING, Furniture Restocking Fee, Y"),
	C505("505","58213000, MHF ACCESSORIES, Furniture Restocking Fee, Y"),
	C506("506","58213000, FURNITURE AND CARPETS, Furniture Restocking Fee, Y"),
	C507("507","58213000, OCCASIONAL FURNITURE, Furniture Restocking Fee, Y"),
	C508("508","58213000, ENTERTAINMENT AND WALL UNITS, Furniture Restocking Fee, Y"),
	C509("509","58213000, DINING ROOM, Furniture Restocking Fee, Y"),
	C510("510","58213000, BEDROOM FURNITURE, Furniture Restocking Fee, Y"),
	C513("513","58213000, FURNITURE, Furniture Restocking Fee, Y"),
	C514("514","58213000, GLUCKSTEIN BED/DINING, Furniture Restocking Fee, Y"),
	C515("515","58212374, MATTRESSES AND BOX SPRINGS, Mattress Disposal Fee, Y"),
	C516("516","58212374, BEDS, Mattress Disposal Fee, Y"),
	C517("517","58213000, SOFA BEDS, Furniture Restocking Fee, Y"),
	C518("518","58213000, READY TO ASSEMBLE FURNITURE, Furniture Restocking Fee, Y"),
	C519("519","58213000, DINETTES, Furniture Restocking Fee, Y"),
	C520("520","58213000, CHAIRS, Furniture Restocking Fee, Y"),
	C521("521","58213000, ACCENT CHAIRS, Furniture Restocking Fee, Y"),
	C522("522","58213000, SUMMER FURNITURE, Furniture Restocking Fee, Y"),
	C681("681","58195785, TV AND VCR STANDS, Electronic Restocking Fee, Y"),
	C682("682","58195785, TELEVISIONS, Electronic Restocking Fee, Y"),
	C683("683","58195785, VCR'S AND CAMCORDERS, Electronic Restocking Fee, Y"),
	C686("686","58195785, Satellite/ Home Entertainment Furniture, Electronic Restocking Fee, Y"),
	C687("687","58195785, STEREO EQUIPMENT, Electronic Restocking Fee, Y");
	
	private String code;
	private String value;
	private String[] splitValues;
	
	private RestockingFeeCategory(String code, String value) {
		this.code= code;
		this.value=value;
	}

	/**
	 * 
	 * @param cofiValue
	 * @return
	 */
	public static String getRestockingFeeCategoryInfo(String cofiValue) {
		for (RestockingFeeCategory rfc : RestockingFeeCategory.values()) {
			if (rfc.code.equals(cofiValue)) {
				return rfc.value;
			}
		}
		return null;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}
	
	public static boolean isItemCategoryExists(String cofiValue) {
		for (RestockingFeeCategory rfc : RestockingFeeCategory.values()) {
			if (rfc.code.equals(cofiValue)) {
				return true;
			}
		}
		return false;
	}
	
	public static String getRestockingFeeSKU(String cofiValue) {
		for (RestockingFeeCategory rfc : RestockingFeeCategory.values()) {
			if (rfc.code.equals(cofiValue)) {
				rfc.splitValues = rfc.value.split(",");
				return rfc.splitValues[0]; // SKU
			}
		}
		return null;
	}
	
	public static String getRestockingFeeDescription(String cofiValue) {
		for (RestockingFeeCategory rfc : RestockingFeeCategory.values()) {
			if (rfc.code.equals(cofiValue)) {
				rfc.splitValues = rfc.value.split(",");
				return rfc.splitValues[1]; // Description
			}
		}
		return null;
	}

	public static String getRestockingFeeComments(String cofiValue) {
		for (RestockingFeeCategory rfc : RestockingFeeCategory.values()) {
			if (rfc.code.equals(cofiValue)) {
				rfc.splitValues = rfc.value.split(",");
				return rfc.splitValues[2]; // Comments
			}
		}
		return null;
	}

	public static String isUsageFeeRequired(String cofiValue) {
		for (RestockingFeeCategory rfc : RestockingFeeCategory.values()) {
			if (rfc.code.equals(cofiValue)) {
				rfc.splitValues = rfc.value.split(",");
				return rfc.splitValues[3]; // Usage Fee Required
			}
		}
		return null;
	}
	
	public static boolean isItemExistsInElectronics(String skuName) {
		for (RestockingFeeCategory rfc : RestockingFeeCategory.values()) {
			rfc.splitValues = rfc.value.split(",");			
			if ("58195785".equals(rfc.splitValues[0])) {
				return true;
			}
		}
		return false;
	}

	public static boolean isItemExistsInMattress(String skuName) {
		for (RestockingFeeCategory rfc : RestockingFeeCategory.values()) {
			rfc.splitValues = rfc.value.split(",");			
			if ("58212374".equals(rfc.splitValues[0])) {
				return true;
			}
		}
		return false;
	}
	
	public static boolean isItemExistsInFurniture(String skuName) {
		for (RestockingFeeCategory rfc : RestockingFeeCategory.values()) {
			rfc.splitValues = rfc.value.split(",");			
			if ("58213000".equals(rfc.splitValues[0])) {
				return true;
			}
		}
		return false;
	}	
}